/*
 * @Date: 2023-03-09 16:43:21
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-10 20:12:53
 * @FilePath: \A19\backend\src\api\QuestionsSys\ApiSaveTest.ts
 */
import { ApiCall } from "tsrpc";
import { ReqSaveTest, ResSaveTest } from "../../shared/protocols/QuestionsSys/PtlSaveTest";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqSaveTest, ResSaveTest>) {
    // TODO
    const examOrHomework = call.req.examOrHomework
    const ret = await Global.collection(examOrHomework === 'exam'?'tests':'homework').updateOne({
        _id:call.req.testId
    },{
        $set:{
            startTime:call.req.startTime,
            endTime:call.req.endTime,
            name:call.req.name,
            questions:call.req.questions,
        }
    })

    call.succ({
        
    })
}